package com.zkyc.framework.website.service.impl;



import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zkyc.framework.common.pojo.ClientMsg;
import com.zkyc.framework.common.pojo.FileVerification;
import com.zkyc.framework.website.mapper.ClientMsgMapper;
import com.zkyc.framework.website.mapper.FileVerificationMapper;
import com.zkyc.framework.website.service.ClientMsgService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
@Slf4j
public class ClientMsgServiceImpl extends ServiceImpl<ClientMsgMapper, ClientMsg> implements ClientMsgService {

    @Autowired
    private ClientMsgMapper clientMsgMapper;

    @Autowired
    private FileVerificationMapper fileVerificationMapper;

    @Override
    @Transactional
    public boolean delete(Integer id) {
        clientMsgMapper.deleteById(id);
        LambdaUpdateWrapper<FileVerification> luw = new LambdaUpdateWrapper<>();
        luw.eq(FileVerification::getCid, id);
        fileVerificationMapper.delete(luw);
        return true;
    }
}
